Table Inventory

Inventory manipulation

Functions

GiveItem(item[, count]) Add x of an item to the inventory.
TakeItem(item[, count]) Remove x of a certain item from the inventory.
GetItemCount(item) Get the amount the player holds of an item.
SetItemCount(item, count) Set the amount of a certain item the player has in the inventory.


Functions

GiveItem(item[, count])
Add x of an item to the inventory. Omitting the second argument will give the "default" amount of the item (i.e. the amount the player would get from a pickup of that type). For example, giving crossbow ammo without specifying the number would give the player 10 instead. Has no effect if the player has an infinite number of that item.

Parameters:

  • item ObjID the item to be added
  • count int the number of items to add (default: the amount you would get from a pickup) (optional)
TakeItem(item[, count])
Remove x of a certain item from the inventory. As in GiveItem, omitting the count will remove the "default" amount of that item. Has no effect if the player has an infinite number of the item.

Parameters:

  • item ObjID the item to be removed
  • count int the number of items to remove (default: the amount you would get from a pickup) (optional)
GetItemCount(item)
Get the amount the player holds of an item.

Parameters:

  • item ObjID the ID item to check

Returns:

    int the amount of the item the player has in the inventory. -1 indicates an infinite amount of that item.
SetItemCount(item, count)
Set the amount of a certain item the player has in the inventory. Similar to GiveItem but replaces with the new amount instead of adding it.

Parameters:

  • item ObjID the ID of the item to be set.
  • count int the number of items the player will have. A value of -1 will give an infinite amount of that item.
generated by TEN-LDoc (a fork of LDoc 1.4.6) Last updated 2023-06-03 11:42:57